<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
var timer;
function startTimer(){
  timer= setInterval("alert('定时器测试')",1000);  //1秒执行一次
}

function stopTimer(){
  clearInterval(timer);
}
</script>

</head>

<body>
 <input type="button"  value="开始定时器" onclick="startTimer()"/>
 <input type="button"  value="停止定时器" onclick="stopTimer()"/>
  </tr>
</table>
</body>
</html>